<template>
  <div class="storage">
    <el-card style="" shadow="never" v-loading="loading">
      <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
        <el-tab-pane label="后台设置" name="website">
          <el-form :model="formData" label-width="100px">
            <el-form-item label="LOGO">
              <el-input v-model="formData.name" />
            </el-form-item>
            <el-form-item label="网站名称">
              <el-input v-model="formData.name" />
            </el-form-item>
            <el-form-item label="备案号">
              <el-input v-model="formData.icp" />
            </el-form-item>
            <el-form-item label="控制台视图">
              <el-input v-model="formData.dashboard_component" />
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="onSubmit">保存</el-button>
              <el-button>重置</el-button>
            </el-form-item>
          </el-form>
        </el-tab-pane>
        <el-tab-pane label="Config" name="second">Config</el-tab-pane>
        <el-tab-pane label="Role" name="third">Role</el-tab-pane>
        <el-tab-pane label="Task" name="fourth">Task</el-tab-pane>
      </el-tabs>
    </el-card>
  </div>
</template>
  <script setup>
import api from "@/app/admin/api";
import { reactive, ref } from "vue";
import feedback from '@/lite/utils/feedback'
const activeName = ref("website");

const formData = reactive({
  dashboard: "",
});


const onSubmit = async()=>{
    const res = await api.system.update(formData)
    feedback.msgSuccess('更新成功');
}

const getSystem = async()=>{
    const {data} = await api.system.detail()
    for (const key in data) {
        formData[key] = data[key];
      }
}
getSystem()
</script>
  